<template>
  <view class="box">
    <view :class="{
      'clip-text': true,
      'clip-text-active': isShow
    }" data-text=" 飞鸽"></view>
  </view>

</template>

<script setup>
import { onLoad, onShow } from '@dcloudio/uni-app';
import { useUserStore } from "../../store//modules/user"
let userStore = useUserStore()
import { ref } from 'vue';
let isShow = ref(false);
onShow(() => {
  setTimeout(() => {
    isShow.value = true;
  }, 500)
  let user = uni.getStorageSync('user')
  if (!user) {
    setTimeout(() => {
      uni.reLaunch({ url: '/pages/login/login' })
    }, 2000)
  } else {
    console.log(456465465465);
    uni.switchTab({ url: `/pages/chatList/chatList` })
  }
})
onLoad(() => {
  let user = uni.getStorageSync('user')
  if (user) {
    userStore.user = user
    let show = uni.getStorageSync('show')
    if (show) {
      uni.switchTab({
        url: '/pages/chatList/chatList',
      })
    } else {
      uni.setStorageSync('show', true)
    }
  } else {
    uni.navigateTo({
      url: '/pages/login/login',
    })
  }
})
</script>

<style lang="scss" scoped>
.box {
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;

  .clip-text {
    font-size: 60px;
    font-weight: bold;
    opacity: 0;
    transition: all 1s;
  }

  .clip-text-active {
    opacity: 1;
  }

  .clip-text::before {
    color: transparent;
    content: attr(data-text);
    /* 使用data-text属性来避免伪元素遮挡实际文本 */
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 1;
    // opacity: 0;
    background: linear-gradient(78deg, #96fbc4 0%, #f9f586 100%);
    -webkit-background-clip: text;
    background-clip: text;
    transform: translate(-50%, -50%);

  }
}
</style>